#ifndef MVC_MODEL_H
#define MVC_MODEL_H

#include <QAbstractTableModel>

#include <iostream>
using namespace std;
//QPair<QString,int>* config_data;

class mvc_model : public QAbstractTableModel
{
     Q_OBJECT

public:
    mvc_model();
    mvc_model( QMap<QString,int> &datamap,QObject* parent=0);
    int rowCount(const QModelIndex &parent = QModelIndex()) const ;
    int columnCount(const QModelIndex &parent = QModelIndex()) const;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
    Qt::ItemFlags flags(const QModelIndex & index) const ;
    QMap<QString,int> datamap;
    void init(QMap<QString,int> &datamap);

public slots:
     void save(QMap<QString,int> &datamap);

private:
     QList<QString > keylist;
     int cols;
     int rows;



};

 QDataStream & operator <<(QDataStream &out,const mvc_model &mvcm );
 QDataStream & operator >>(QDataStream &in, mvc_model &mvcm );



#endif // MVC_MODEL_H
